package com.zhentao.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.dto.product.CategoryBrandDto;
import com.zhentao.entity.product.Brand;
import com.zhentao.entity.product.CategoryBrand;
import com.zhentao.service.CategoryBrandService;
import com.zhentao.mapper.CategoryBrandMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Lenovo
* @description 针对表【category_brand(分类品牌)】的数据库操作Service实现
* @createDate 2024-09-02 18:38:04
*/
@Service
public class CategoryBrandServiceImpl extends ServiceImpl<CategoryBrandMapper, CategoryBrand>
    implements CategoryBrandService{
    @Resource
    private CategoryBrandMapper categoryBrandMapper;

    /**
     * 品牌分类列表
     * @param categoryBrandDto
     * @return
     */
    @Override
    public Page<CategoryBrand> findByPage(CategoryBrandDto categoryBrandDto) {
        Page<CategoryBrand> page = new Page<>(categoryBrandDto.getPage(),categoryBrandDto.getLimit());
        Page<CategoryBrand> page1 = categoryBrandMapper.findByPage(page,categoryBrandDto);
        return page1;
    }
    /**
     * 加载品牌数据
     * @param categoryId
     * @return
     */
    @Override
    public List<Brand> findBrandByCategoryId(Long categoryId) {
        return categoryBrandMapper.findBrandByCategoryId(categoryId);
    }
}




